package interview.linkedlist;

import algorithm.model.ListNode;

/**
 * Created by yzy on 2021-03-18 01:01
 */
public class ReverseLinkedList {

    public static ListNode reverseList(ListNode head) {
        ListNode tmp;
        ListNode first = null;
        while(head != null){
            tmp = head;
            head = head.next;
            tmp.next = first;
            first = tmp;
        }
        return first;
    }

}
